

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Activity</title>
    </head>
    <body>
        <div class="body">
            <h1>編輯</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${activityInstance}">
            <div class="errors">
                <g:renderErrors bean="${activityInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${activityInstance?.id}" />
                <input type="hidden" name="version" value="${activityInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name">名稱:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'name','errors')}">
                                    <input type="text" id="name" name="name" value="${fieldValue(bean:activityInstance,field:'name')}"/>
                                </td>
                            </tr> 
                        
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="startAt">開始:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'startAt','errors')}">
                                    <g:datePicker name="startAt" value="${activityInstance?.startAt}" precision="minute" ></g:datePicker>
                                </td>
                            </tr>
                                
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="endAt">結束:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'endAt','errors')}">
                                    <g:datePicker name="endAt" value="${activityInstance?.endAt}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="records">應出席人員:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:activityInstance,field:'records','errors')}">
                                    
									<ul>
									<g:each var="r" in="${activityInstance?.records?}">
									    <li>${r.person.name}</li>
									</g:each>
									</ul>
									<g:link controller="record" params="['activity.id':activityInstance?.id]" action="create">Add Record</g:link>

                                </td>
                            </tr> 
                        
                             
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="更新" action="update"/></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
